Add Migrations 5.0 rector rules for PHINX_TYPE_* constant renaming#361
Merged
markstory merged 1 commit intocakephp:5.xfrom Nov 21, 2025
Merged
Add Migrations 5.0 rector rules for PHINX_TYPE_* constant renaming#361markstory merged 1 commit intocakephp:5.xfrom
markstory merged 1 commit intocakephp:5.xfrom
Conversation
This adds rector rules to automatically upgrade migrations from the deprecated PHINX_TYPE_* constants to the new TYPE_* constants introduced in Migrations 5.0. Changes: - Add config/rector/migrations50.php entry point - Add config/rector/sets/migrations50.php with constant rename rules - Update CakePHPSetList with MIGRATIONS_50 constant - Update README.md with migrations50 documentation The rules rename all deprecated PHINX_TYPE_* constants to their new TYPE_* equivalents, matching the naming conventions of Cake\Database\Schema\TableSchemaInterface: - PHINX_TYPE_STRING -> TYPE_STRING - PHINX_TYPE_TINY_INTEGER -> TYPE_TINYINTEGER - PHINX_TYPE_BINARYUUID -> TYPE_BINARY_UUID - etc. See: cakephp/migrations#948
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Migrations 5.0 rector rules for PHINX_TYPE_* constant renaming
Summary
This PR adds rector rules to automatically upgrade migrations from the deprecated
PHINX_TYPE_*constants to the newTYPE_*constants introduced in Migrations 5.0.Changes
config/rector/migrations50.phpentry pointconfig/rector/sets/migrations50.phpwith constant rename rulesCakePHPSetListwithMIGRATIONS_50constantREADME.mdwith migrations50 documentationUsage
Users can now upgrade their migrations using:
cd /path/to/upgrade bin/cake upgrade rector --rules migrations50 /path/to/your/app/configDetails
The rules rename all deprecated
PHINX_TYPE_*constants to their newTYPE_*equivalents, matching the naming conventions ofCake\Database\Schema\TableSchemaInterface:Standard Types
PHINX_TYPE_STRING→TYPE_STRINGPHINX_TYPE_INTEGER→TYPE_INTEGERPHINX_TYPE_BOOLEAN→TYPE_BOOLEANMulti-word Types (no underscores)
PHINX_TYPE_TINY_INTEGER→TYPE_TINYINTEGERPHINX_TYPE_SMALL_INTEGER→TYPE_SMALLINTEGERPHINX_TYPE_BIG_INTEGER→TYPE_BIGINTEGERUUID Types (with underscores)
PHINX_TYPE_BINARYUUID→TYPE_BINARY_UUIDPHINX_TYPE_NATIVEUUID→TYPE_NATIVE_UUIDGeospatial Types
PHINX_TYPE_GEOMETRY→TYPE_GEOMETRYPHINX_TYPE_POINT→TYPE_POINTPHINX_TYPE_LINESTRING→TYPE_LINESTRINGPHINX_TYPE_POLYGON→TYPE_POLYGONPHINX_TYPES_GEOSPATIAL→TYPES_GEOSPATIALDatabase-specific Types
PHINX_TYPE_YEAR→TYPE_YEAR(MySQL)PHINX_TYPE_CIDR→TYPE_CIDR(PostgreSQL)PHINX_TYPE_INET→TYPE_INET(PostgreSQL)PHINX_TYPE_MACADDR→TYPE_MACADDR(PostgreSQL)PHINX_TYPE_INTERVAL→TYPE_INTERVAL(PostgreSQL)Related Issue
cakephp/migrations#948
Testing
The rector rules can be tested by running them against migration files that use the old constants. Example:
Before:
After: